x86/vmx: introduce vmwrite_safe()
authorSergey Dyasli <sergey.dyasli@citrix.com>
Thu, 9 Feb 2017 10:07:01 +0000 (11:07 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 9 Feb 2017 10:07:01 +0000 (11:07 +0100)
commitd4a24c64b60dc265778419e925382d8b817908f9
tree36bc226a1ba634b172cf635c615a6a1ec1639a34
parentea4e7040eedd81704a6f3ff5fa2e6d6e0bb374c9
x86/vmx: introduce vmwrite_safe()

Any fail during the original __vmwrite() leads to BUG() which can be
easily exploited from a guest in the nested vmx mode.

The new function returns error code depending on the outcome:

          VMsucceed: 0
        VMfailValid: VM Instruction Error Number
      VMfailInvalid: a new VMX_INSN_FAIL_INVALID

A new macro GAS_VMX_OP is introduced in order to improve the
readability of asm.  Existing ASM_FLAG_OUT macro is reused and copied
into asm_defns.h

Signed-off-by: Sergey Dyasli <sergey.dyasli@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
xen/arch/x86/hvm/vmx/vvmx.c
xen/include/asm-x86/asm_defns.h
xen/include/asm-x86/hvm/vmx/vmcs.h
xen/include/asm-x86/hvm/vmx/vmx.h